package com.yan.yjhTest.collection.list;

import java.util.ArrayList;
import java.util.List;

/**
 * 写出下面的运行结果
 * 报错
 */
public class ListTest {
    public static void main(String[] args) {
        List<String> list = null;
        ListTest It = new ListTest();
        It.test(list);
        list.add("3");
        list.add("4");
        System.out.println(list.size());
    }

    public void test(List<String> list){
        if (list == null){
            list = new ArrayList<String>();
        }
        list.add("1");
        list.add("2");
    }
}
